<?php //pack11class

class LanguagesSwitcher extends Module {

    public function setup() {

        $str=array();

        foreach(LanguagesManager::getLanguages() as $language) {
            if($language->id!=LanguagesManager::current()) {
                $setting=SettingsManager::getSetting("language");
                $langSetting=clone $setting;
                $langSetting->value=$language->id;
                $queryObject=new GetQueryObject();
                $queryObject=GetQuery::useDefinedVars();
                $queryObject->setValue($langSetting, GetQueryObject::SETTING);
                $query=GetQuery::generate($queryObject);
                array_push($str,str_replace('\"','"',"<a href=\"?state=".$query."\">".$language->label."</a>"));
            }
        }
       $this->setBody(implode("&nbsp;|&nbsp;",$str));
    }

}
?>
